From: Lukáš Tyrychtr Date: Tue, 24 Sep 2024 10:53:17 +0000 (+0200) Subject: bluetooth: Name the device items for a11y X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~173^2^2~208 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=4b04fc49b51299704d8197abe0279370604a437f;p=gnome-shell.git bluetooth: Name the device items for a11y By doing that, they're finally announced by a screen reader. Part-of: --- diff --git a/js/ui/status/bluetooth.js b/js/ui/status/bluetooth.js index 5d3581c42..c1d6837a8 100644 --- a/js/ui/status/bluetooth.js +++ b/js/ui/status/bluetooth.js @@ -247,6 +247,9 @@ class BluetoothDeviceItem extends PopupMenu.PopupBaseMenuItem { this.connect('destroy', () => (this._spinner = null)); this.connect('activate', () => this._toggleConnected().catch(logError)); + this._device.connect('notify::alias', () => this._updateAccessibleName()); + this._device.connect('notify::connected', () => this._updateAccessibleName()); + this._updateAccessibleName(); } async _toggleConnected() { @@ -254,6 +257,14 @@ class BluetoothDeviceItem extends PopupMenu.PopupBaseMenuItem { await this._client.toggleDevice(this._device); this._spinner?.stop(); } + + _updateAccessibleName() { + this.accessible_name = this._device.connected + // Translators: %s is a device name like "MyPhone" + ? _('Disconnect %s').format(this._device.alias) + // Translators: %s is a device name like "MyPhone" + : _('Connect to %s').format(this._device.alias); + } }); const BluetoothToggle = GObject.registerClass(